package com.egg.demo.controller.web;

import com.alibaba.fastjson.JSONObject;
import com.egg.common.core.model.controller.WebController;
import com.egg.common.core.model.response.ResponseData;
import com.egg.demo.rabbitmq.sender.DemoSender;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@Slf4j
@Api(tags = WebController.API_PREFIX + "消息队列")
@RestController
@RequestMapping("/rabbit/mq")
public class WebRabbitMqController extends WebController {


    @Autowired
    private DemoSender demoSender;


    @ApiOperation(value = "测试发送消息")
    @PostMapping
    public ResponseData<String> testPost(@RequestBody JSONObject json) {
        demoSender.send(json);
        return ResponseData.success();
    }



}

